const userHelp=require('../database/users/userHelp')


    //转换type=4,为type=1
    const transformMsgType=async(msg,to_uid)=>{
        let msg_=JSON.parse(JSON.stringify(msg))
        let isNeed=await isNeedTransformMsgType(to_uid)
        if(isNeed){
            if(msg_.msgType==4){
                msg_.msgType=1
            }
        }
        return msg_
    }


    //是否需要转换type
    const isNeedTransformMsgType=async (to_uid)=>{
        let isOldUser=await userHelp.isUserInOldAppVersion(to_uid)
        if(isOldUser){
            return true
        }
        return false
    }





module.exports={
    transformMsgType:transformMsgType,
}
